use text colors from widget style to draw cursor instead of hardcoded
authorYevgen Muntyan <muntyan@tamu.edu>
Fri, 1 Jun 2007 05:02:05 +0000 (05:02 +0000)
committerYevgen Muntyan <muntyan@src.gnome.org>
Fri, 1 Jun 2007 05:02:05 +0000 (05:02 +0000)
2007-05-31  Yevgen Muntyan  <muntyan@tamu.edu>

* gtk/gtkstyle.c (get_insertion_cursor_gc): use text colors from
widget style to draw cursor instead of hardcoded black and grey
(#79585, comment #30).

svn path=/trunk/; revision=17998

ChangeLog
gtk/gtkstyle.c

index bf18258e31388646d0ede1fcf2f68b48ad4137aa..66edb1dd7cdb80de3975afee6f64498323b33157 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-05-31  Yevgen Muntyan  <muntyan@tamu.edu>
+
+       * gtk/gtkstyle.c (get_insertion_cursor_gc): use text colors from
+       widget style to draw cursor instead of hardcoded black and grey
+       (#79585, comment #30).
+
 2007-06-01  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtkcellrenderertext.c (get_size): transform the ink_rect using
index a673e4fcfd6f3aefef41aca391ce25732c7f6c23..763cc370861cc39823ae3918d581372584e32cd2 100644 (file)
@@ -6641,24 +6641,26 @@ get_insertion_cursor_gc (GtkWidget *widget,
        }
     }
 
+  /* Cursors in text widgets are drawn only in NORMAL state,
+   * so we can use text[GTK_STATE_NORMAL] as text color here */
   if (is_primary)
     {
       if (!cursor_info->primary_gc)
        cursor_info->primary_gc = make_cursor_gc (widget,
                                                  "cursor-color",
-                                                 &widget->style->black);
-       
+                                                 &widget->style->text[GTK_STATE_NORMAL]);
+
       return cursor_info->primary_gc;
     }
   else
     {
-      static const GdkColor gray = { 0, 0x8888, 0x8888, 0x8888 };
-      
       if (!cursor_info->secondary_gc)
        cursor_info->secondary_gc = make_cursor_gc (widget,
                                                    "secondary-cursor-color",
-                                                   &gray);
-       
+                                                   /* text_aa is the average of text and base colors,
+                                                    * in usual black-on-white case it's grey. */
+                                                   &widget->style->text_aa[GTK_STATE_NORMAL]);
+
       return cursor_info->secondary_gc;
     }
 }